package com.beerbear.consumer.config.listener;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalTime;

/**
 * @Author: Beer Bear
 * @Description: 消息队列-发布订阅模式
 * @Date: 2021/9/3 12:07
 */
@Component
public class SpringRabbitMQListenerForFanout {
    @RabbitListener(queues = "fanout.queue1")
    public void listenWorkQueue1(String msg) {
        System.out.println("消费者接收fanout.queue1的消息:" + msg + LocalTime.now());
    }

    @RabbitListener(queues = "fanout.queue2")
    public void listenWorkQueue2(String msg) {
        System.out.println("消费者接收fanout.queue1的消息:" + msg + LocalTime.now());
    }
}
